home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 July: Mac OS SDK / Dev.CD Jul 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Interfaces / PInterfaces / PasLibIntf.p < prev    next >
Encoding:
Text File  |  1995-08-05  |  6.9 KB  |  290 lines  |  [TEXT/MPS ]

  1. {*-------------------------------------------------------------------------------*
  2.  |                                                                                 |
  3.  |                          <<< Pascal Library Interface >>>                         |
  4.  |                                                                                 |
  5.  |                      Copyright Apple Computer, Inc. 1986, 1992, 1994             |
  6.  |                               All rights reserved.                              |
  7.  |                                                                                 |
  8.  *-------------------------------------------------------------------------------*}
  9.  
  10. {
  11.  Interface to the Pascal I/O and Memory Manager Library.
  12.  Built-in procedure and function declarations are marked with
  13.  the (* *) comment characters
  14. }
  15.  
  16. {$IFC UNDEFINED UsingIncludes}
  17. {$SETC UsingIncludes := 0}
  18. {$ENDC}
  19.  
  20. {$IFC NOT UsingIncludes}
  21.     UNIT PASLIBIntf;
  22.       INTERFACE
  23. {$ENDC}
  24.  
  25. {$IFC UNDEFINED UsingPASLIBINTF AND UNDEFINED __PASLIBINTF__}
  26. {$SETC UsingPASLIBINTF := 1}
  27.  
  28. {$I+}
  29. {$SETC PASLIBINTFIncludes := UsingIncludes}
  30. {$SETC UsingIncludes := 1}
  31. {$IFC UNDEFINED UsingTypes AND UNDEFINED __TYPES__}
  32. {$I $$Shell(PInterfaces)Types.p}
  33. {$ENDC}
  34. {$IFC UNDEFINED UsingFiles AND UNDEFINED __FILES__}
  35. {$I $$Shell(PInterfaces)Files.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED UsingAliases AND UNDEFINED __ALIASES__}
  38. {$I $$Shell(PInterfaces)Aliases.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __CONDITIONALMACROS__}
  41. {$I ConditionalMacros.p}
  42. {$ENDC}
  43.  
  44. {$ALIGN MAC68K}
  45. {$SETC UsingIncludes := PASLIBINTFIncludes}
  46.  
  47.     TYPE
  48.       PASCALPOINTER = ^INTEGER; { Universal POINTER type }
  49.       PASCALFILE = FILE; { Universal FILE type }
  50. (*
  51.  *      PASCALBLOCK =    { Universal block of chars }
  52.  *            PACKED ARRAY [0..511] OF CHAR;
  53.  *)
  54.  
  55.     CONST
  56.       { <StdIO.h> PLSetVBuf styles }
  57.       _IOFBF = $00; { File buffering }
  58.       _IOLBF = $40; { Line buffering }
  59.       _IONBF = $04; { No buffering }
  60.  
  61. {
  62.  Mac Pascal heap management
  63. }
  64.  
  65.     PROCEDURE PLHeapInit(sizepheap: LONGINT; heapDelta: LONGINT;
  66.                          memerrProc: UNIV PASCALPOINTER; allowNonCont: BOOLEAN;
  67.                          forDispose: BOOLEAN);
  68. {
  69.  The following procedure is obsolete, use PLHeapInit
  70. }
  71.  
  72.     PROCEDURE PLInitHeap(sizepheap: LONGINT; memerrProc: UNIV PASCALPOINTER;
  73.                          allowNonCont: BOOLEAN; allowDispose: BOOLEAN);
  74.  
  75.     PROCEDURE PLSetNonCont(allowNonCont: BOOLEAN);
  76.  
  77.     PROCEDURE PLSetMErrProc(memerrProc: UNIV PASCALPOINTER);
  78.  
  79.     PROCEDURE PLSetHeapType(forDispose: BOOLEAN);
  80.  
  81.     PROCEDURE PLSetHeapCheck(DoIt: BOOLEAN);
  82.  
  83. {
  84.  File I/O
  85. }
  86.  
  87. (*
  88.  *      PROCEDURE
  89.  *        RESET(VAR fvar:  UNIV PASCALFILE; OPT fname: STRING);
  90.  *        BUILTIN;
  91.  *
  92.  *      PROCEDURE
  93.  *        REWRITE(VAR fvar: UNIV PASCALFILE; OPT fname: STRING);
  94.  *        BUILTIN;
  95.  *
  96.  *      PROCEDURE
  97.  *        OPEN(VAR fvar:    UNIV PASCALFILE; fname: STRING);
  98.  *        BUILTIN;
  99.  *)
  100.  
  101.     PROCEDURE PLSetVBuf(VAR fvar: TEXT; buffer: UNIV PASCALPOINTER;
  102.                         style: INTEGER; bufsize: INTEGER);
  103. (*
  104.  *      FUNCTION
  105.  *        BLOCKREAD(
  106.  *          VAR fvar: FILE;
  107.  *          VAR buffer: UNIV PASCALBLOCK;
  108.  *          nBlocks: INTEGER;
  109.  *          OPT stBlock:INTEGER
  110.  *        ):
  111.  *        INTEGER;
  112.  *        BUILTIN;
  113.  *
  114.  *      FUNCTION
  115.  *        BLOCKWRITE(
  116.  *          VAR fvar: FILE;
  117.  *          VAR buffer: UNIV PASCALBLOCK;
  118.  *          nBlocks: INTEGER;
  119.  *          OPT stBlock:INTEGER
  120.  *        ):
  121.  *        INTEGER;
  122.  *        BUILTIN;
  123.  *
  124.  *      FUNCTION
  125.  *        BYTEREAD(
  126.  *          VAR fvar: FILE;
  127.  *          VAR buffer: UNIV PASCALBLOCK;
  128.  *          nBytes:  LONGINT;
  129.  *          OPT stByte: LONGINT
  130.  *        ):
  131.  *        LONGINT;
  132.  *        BUILTIN;
  133.  *
  134.  *      FUNCTION
  135.  *        BYTEWRITE(
  136.  *          VAR fvar: FILE;
  137.  *          VAR buffer: UNIV PASCALBLOCK;
  138.  *          nBytes:  LONGINT;
  139.  *          OPT stByte: LONGINT
  140.  *        ):
  141.  *        LONGINT;
  142.  *        BUILTIN;
  143.  *
  144.  *      FUNCTION
  145.  *        EOF(OPT VAR fvar: UNIV PASCALFILE):
  146.  *        BOOLEAN;
  147.  *        BUILTIN;
  148.  *
  149.  *      FUNCTION
  150.  *        EOLN(OPT VAR fvar: TEXT):
  151.  *        BOOLEAN;
  152.  *        BUILTIN;
  153.  *
  154.  *      PROCEDURE
  155.  *        READ(VAR fvar: TEXT; OPT EXPR_LIST);
  156.  *        BUILTIN;
  157.  *
  158.  *      PROCEDURE
  159.  *        READLN(OPT VAR fvar: TEXT; OPT EXPR_LIST);
  160.  *        BUILTIN;
  161.  *
  162.  *      PROCEDURE
  163.  *        WRITE(VAR fvar: TEXT; OPT EXPR_LIST);
  164.  *        BUILTIN;
  165.  *
  166.  *      PROCEDURE
  167.  *        WRITELN(OPT VAR fvar: TEXT; OPT EXPR_LIST);
  168.  *        BUILTIN;
  169.  *
  170.  *      PROCEDURE
  171.  *        GET(VAR fvar: UNIV PASCALFILE);
  172.  *        BUILTIN;
  173.  *
  174.  *      PROCEDURE
  175.  *        PUT(VAR fvar: UNIV PASCALFILE);
  176.  *        BUILTIN;
  177.  *
  178.  *      PROCEDURE
  179.  *        SEEK(VAR fvar: UNIV PASCALFILE; recno: LONGINT);
  180.  *        BUILTIN;
  181.  *)
  182.  
  183.     FUNCTION PLFilePos(VAR fvar: UNIV PASCALFILE): LONGINT;
  184.  
  185.     PROCEDURE PLFlush(VAR fvar: TEXT);
  186.  
  187.     PROCEDURE PLCrunch(VAR fvar: UNIV PASCALFILE);
  188.     
  189. {
  190.  Directory operations.
  191. }
  192.  
  193.     PROCEDURE PLPurge(fname: STRING);
  194.  
  195.     PROCEDURE PLRename(oldFname, newFname: STRING);
  196.  
  197. {
  198.  Miscellaneous Operations
  199. }
  200.  
  201. {$IFC NOT UNDEFINED __CFM68K__}
  202.     {$IFC NOT UNDEFINED UsingSharedLibs}
  203.         {$PUSH}
  204.         {$LibExport+}
  205.     {$ENDC}
  206. {$ENDC}
  207.  
  208. { The following definition has been moved to MacRuntime.p }
  209. {    FUNCTION TrapAvailable(trap: INTEGER): BOOLEAN; }
  210.  
  211. { The following functions can no longer be called directly from Pascal.
  212.   They have been replaced by IExxxxx glue routines, defined below. }
  213.  
  214.  {
  215.     FUNCTION ResolveFolderAliases (volume: INTEGER; directory: LONGINT;
  216.                                    path: Str255; resolveLeafName: BOOLEAN;
  217.                                    VAR theSpec: FSSpec; VAR isFolder, hadAlias,
  218.                                    leafIsAlias: BOOLEAN): OSErr; C;
  219.  
  220.     FUNCTION MakeResolvedFSSpec (volume: INTEGER; directory: LONGINT;
  221.                                  path: Str255; VAR theSpec: FSSpec; VAR isFolder,
  222.                                  hadAlias, leafIsAlias: BOOLEAN): OSErr; C;
  223.     
  224.     FUNCTION MakeResolvedPath (volume: INTEGER; directory: LONGINT; path: Str255;
  225.                                resolveLeafAlias: BOOLEAN; VAR buffer: Str255;
  226.                                VAR isFolder, hadAlias, leafIsAlias: BOOLEAN):
  227.                                OSErr; C;
  228. }
  229.  
  230.     FUNCTION IEResolveFolderAliases (volume: INTEGER; directory: LONGINT;
  231.                                      path: Str255; resolveLeafName: BOOLEAN;
  232.                                      VAR theSpec: FSSpec; VAR isFolder, hadAlias,
  233.                                      leafIsAlias: BOOLEAN): OSErr;
  234.  
  235.     FUNCTION IEMakeResolvedFSSpec (volume: INTEGER; directory: LONGINT;
  236.                                    path: Str255; VAR theSpec: FSSpec; VAR isFolder,
  237.                                    hadAlias, leafIsAlias: BOOLEAN): OSErr;
  238.     
  239.     FUNCTION IEResolvePath (VAR rawPath: Str255; VAR resolvedPath: Str255;
  240.                             VAR isFolder, hadAlias: BOOLEAN): OSErr;
  241.  
  242.     FUNCTION IEMakeResolvedPath (volume: INTEGER; directory: LONGINT; path: Str255;
  243.                                  resolveLeafAlias: BOOLEAN; VAR buffer: Str255;
  244.                                  VAR isFolder, hadAlias, leafIsAlias: BOOLEAN):
  245.                                  OSErr;
  246. {
  247.  C string functions for Pascal strings
  248. }
  249.      FUNCTION PLStrCmp(string1, string2: Str255): INTEGER;
  250.  
  251.     FUNCTION PLStrnCmp(string1, string2: Str255; n: INTEGER): INTEGER;
  252.  
  253.     FUNCTION PLStrCpy(VAR string1: Str255; string2: Str255): StringPtr;
  254.  
  255.     FUNCTION PLStrnCpy(VAR string1: Str255; string2: Str255; n: INTEGER): StringPtr;
  256.  
  257.     FUNCTION PLStrCat(VAR string1: Str255; string2: Str255): StringPtr;
  258.  
  259.     FUNCTION PLStrnCat(VAR string1: Str255; string2: Str255; n: INTEGER): StringPtr;
  260.  
  261.     FUNCTION PLStrChr(string1: Str255; c: CHAR): Ptr;
  262.  
  263.     FUNCTION PLStrrChr(string1: Str255; c: CHAR): Ptr;
  264.  
  265.     FUNCTION PLStrPBrk(string1, string2: Str255): Ptr;
  266.  
  267.     FUNCTION PLStrSpn(string1, string2: Str255): INTEGER;
  268.  
  269.     FUNCTION PLStrStr(string1, string2: Str255): Ptr;
  270.  
  271.     FUNCTION PLStrLen(string1: Str255): INTEGER;
  272.     
  273.     FUNCTION PLPos(STRING1: Str255; STRING2: Str255): INTEGER;
  274.  
  275. {$IFC NOT UNDEFINED __CFM68K__}
  276.     {$IFC NOT UNDEFINED UsingSharedLibs}
  277.         {$POP}
  278.     {$ENDC}
  279. {$ENDC}
  280.  
  281. {$ALIGN RESET}
  282.  
  283. {$SETC UsingIncludes := PASLIBINTFIncludes}
  284.  
  285. {$ENDC}    { UsingPASLIBINTF }
  286.  
  287. {$IFC NOT UsingIncludes}
  288.     END.
  289. {$ENDC}
  290.